/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package io.renren.common.utils;

import com.aliyun.oss.common.utils.DateUtil;
import io.swagger.models.auth.In;
import org.junit.Test;

import java.util.Date;
import java.util.Random;

/**
 * 系统参数相关Key
 *
 * @author Mark sunlightcs@gmail.com
 */
public class ConfigConstant {
    /**
     * 云存储配置KEY
     */
    public final static String CLOUD_STORAGE_CONFIG_KEY = "CLOUD_STORAGE_CONFIG_KEY";

    /*******************************工程处理解决状况**************************************/
    public final static String HANDLE_INITIAL = "1";
    public final static String HANDLE_HANDLING = "2";
    public final static String HANDLE_FINISH = "3";
    /*******************************工程修后质量状况**************************************/
    public final static String QUALITY_INITIAL ="1";
    public final static String QUALITY_OK ="2";
    public final static String QUALITY_BROKE ="3";
    /*******************************工程状态 **************************************/
    public final static String PROJETCT_INITIAL = "1";
    public final static String PROJETCT_CHKED = "2";
    public final static String PROJETCT_FINISH = "3";
    /*******************************子工程状态 **************************************/
    public final static String PROJETCTDTL_INITIAL = "0";
    public final static String PROJETCTDTL_FINISH = "1";
    /*******************************耗材状态 **************************************/
    public final static String OUTSTATUS_INITIAL = "0";
    public final static String OUTSTATUS_FINISH = "1";
    /*******************************采购单类型 **************************************/
    public final static Integer PURTYPE_NORMAL = 1;  //正常
    public final static Integer PURTYPE_SUPPLY =2;    //补货
    /*******************************采购(细)单状态 **************************************/
    public final static String PURSTATUS_INITIAL = "0";//初始
    public final static String PURSTATUS_FINISH = "1";//完成
    /*******************************库存交易类型 **************************************/
    public final static int STOCK_INT = 0;//入库
    public final static int STOCK_OUT = 1;//出库
    /*********************************上传图片类型*********************************/
    public final static int PIC_BEFORE = 1;//维修前
    public final static int PIC_AFTER = 2;//维修后
    /*********************************来源*********************************/
    public final static String RESOURCE_SHIP = "1"; //船供
    public final static String RESOURCE_SELF = "2"; //自筹
    /*********************************是否雷元仓库*********************************/
    public final static int IFSTORE_Y = 1;//来源仓库
    public final static int IFSTORE_N = 0;//非来源仓库
    public static String getId(){
       return System.currentTimeMillis() + getRandomNumberStr(6);
    }

    /**
     * 自增编号
     * @return
     */

    public static String generateNo(){
        return "SC"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }

    //客户编码
    public static String generateCompanyNo(){
        return "KH"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //工人编号
    public static String generateWorkerNo(){
        return "GR"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //商品编号
    public static String generateGoodsNo(){
        return "SP"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //采购单编号
    public static String generatePurNo(){
        return "CG"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //采购细单编号
    public static String generatePurdtlNo(){
        return "CGDTL"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //合同编号
    public static String generateContractNo(){
        return "HT"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //登记单编号
    public static String generateSignNo(){
        return "DJ"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //报价单编号
    public static String generateQuotationNo(){
        return "BJ"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //杂费单编号
    public static String generateExtrasNo(){
        return "EX"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    //杂费细单编号
    public static String generateExtrasDtlNo() {
        return "EXDTL"+DateUtils.format(new Date(),"yyyyMMddHHmmss");
    }
    private static String getRandomNumberStr(int length){
        StringBuilder builder = new StringBuilder();
        Random random = new Random();
        for(int i = 0 ; i < length; i++){
            builder.append(random.nextInt(10));
        }
        return builder.toString();
    }
}
